import serve from './../Base/Http.js'
import qs from 'qs'
   // 数据列表
   export default {
    user(allPages){
        return serve({
            method:'get',
            params:{
                _gp:"admin.user",
                _mt:"getUser",    
                     //分页
                level:allPages.searchlevel,
                gender:allPages.searchgender,
                status:allPages.searchstatus,
                id:allPages.input,
                nickname: allPages.value,
                pageNo: allPages.currentPage,
                limit: allPages.eachpage
              }
        })
    },
     //编辑
     compile(ruleForm){
       console.log(ruleForm)
        return serve({
            method:'post',
            data:qs.stringify({
                _gp:"admin.user",
                _mt:"updateUser",
                user: JSON.stringify({
                  nickname:ruleForm.nickname, //昵称
                  phone:ruleForm.phone, //号码
                  birthday:ruleForm.birthday, //生日
                  password:ruleForm.password, //密码
                  level:ruleForm.level == "普通会员" ? "0" : "1", //等级
                  gender:ruleForm.gender == "男" ? "2" : "1", //性别
                  status:ruleForm.status == "冻结" ? "0" : "1", //状态
                  id:ruleForm.id
                })
              })
        }) 
    },
    // 添加
    addition(data){
      return serve({
          method:'post',
          data:qs.stringify({
              _gp:"admin.user",
              _mt:"addUser",
              user: JSON.stringify({
                ...data
              })
            })
      }) 
  },
  //删除
  handleDeletec (data){
    return serve({
        method:'post',
        data:qs.stringify(
          {
            _gp:"admin.user",
            _mt:"deleteUser",
            ...data
          }
        )
    })
},
//冻结
status(data){
    return serve({
        method:'post',
        data:qs.stringify({
            _gp:"admin.user",
            _mt:"updateStatus",
              ...data
          })
    }) 
},

}